﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NetPE.Core;
using System.Windows.Forms;

namespace NetPE.TreeNodes
{
    public class FileNode : BaseNode
    {
        public FileNode(PeFile file):base(file)
        {
            f = file;
            if (file.Type == PeFileType.Image) Nodes.Add(new DOSHeaderNode(f.DOSHeader));
            Nodes.Add(new PeHeaderNode(f.PEHeader));
            if (file.Type == PeFileType.Image) Nodes.Add(new OptionalHeaderNode(f.OptionalHeader));
            Nodes.Add(new SectionsNode(f.SectionHeaders));
            if (file.Type == PeFileType.Image) Nodes.Add(new DirectoriesNode(f.OptionalHeader.DataDirectories));
            Nodes.Add(new VirtualSpaceNode(f.SectionHeaders.GetVirtualStream()));
            this.Text = "File";
            this.ImageIndex = this.SelectedImageIndex = NodeType.File;
        }

        PeFile f;
        public override object Data { get { return f; } }

        public override BaseEditor GetEditorControl()
        {
            return new BaseEditor();
        }
    }
}
